<template>
  <div>
    <!-- <button v-on:click="num++">点击</button>
    <span>{{ num }}</span> -->

    <!-- <button v-on:click='fn'>点击2</button> -->
    <!-- <button v-on:click='fn1(5)'>点击3</button> -->


     <!-- <a href='' v-on:click.prevent='fn2'>点击3</a> -->
     <!-- <a href="" @click.prevent='fn2'>点击3</a> -->
  </div>
</template>

<script>
export default {
    //数据源
  data() {
    return {
      num: 0,
    };
  },
  //方法集合
  methods: {
    fn() {
        //要加this this是vue组件
      console.log(this.num)
      this.num++
    },
    fn1(a){
        console.log(a);
    },
    fn2(){
        //阻止默认跳转
    console.log(2);
    }
  },
};
</script>

<style lang="less"></style>
